package com.redrose.audioandvideo.video;

import android.Manifest;
import android.os.Bundle;
import android.view.View;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.redrose.audioandvideo.R;
import com.redrose.audioandvideo.databinding.ActivityVideoBinding;
import com.redrose.audioandvideo.ui.activitys.BaseActivity;

@Route(path = "/activity/video")
public class VideoActivity extends BaseActivity<ActivityVideoBinding> {
    String[] permissoons = new String[]{
            Manifest.permission.RECORD_AUDIO
    };
    private boolean mIsVideo;

    @Override
    public void initData() {

    }

    @Override
    public int setLayout() {
        return R.layout.activity_video;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (!hasPermission(permissoons[0])) {
            requestPeermission(permissoons,1000);
        }
        mBinding.btnVideo.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mIsVideo) {
                    mIsVideo = false;
//                    mBinding.btnVideo.setText("停止录音");
                    mBinding.btnVideo.setBackgroundResource(R.drawable.video_pause);
                } else {
                    mIsVideo = true;
//                    mBinding.btnVideo.setText("停止录音");
                    mBinding.btnVideo.setBackgroundResource(R.drawable.video_start);
                }
            }
        });
    }
}
